<form action="{:U('file/add')}" enctype="multipart/form-data" method="post">	
	<input type="hidden" name="module" value="{$module}"/>
	<input type="hidden" name="r" value="{$r}"/>
	<input type="hidden" name="id" value="{$id}"/>
	<input type="hidden" name="role_id" value="{$Think.session.role_id}">
	<table class="table table-hover">
		<tr>
			<td class="tdleft">{:L('SELECT_FILES')}</td> 
			<td>({:L('FILE_NO_MORE_THAN_20MB')})</td>
		</tr>
		<tr>
			<td class="tdleft">{:L('Attachment')}</td>
			<td><p>{:L('ALLOWED_FILE_TYPES')}{$allowExts}</p>
			<p id="attachment1"><input type="file" name="file[]"/></p> <a id="add_more" href="javascript:add_file(2);">{:L('ADD_AN_ATTACHMENT')}</a></td>
		</tr>		
		<tr> 
			<td>&nbsp;</td>
			<td><input class="btn btn-primary" type="submit" name="submit" value="{:L('ADD')}"/> &nbsp; <input class="btn" onclick="javascript:$('#dialog-file').dialog('close');" type="button" value="{:L('CANCEL')}"/></td>
		</tr>
	</table>
</form>			
<script type="text/javascript">
	function add_file(id) {
		$("#add_more").before('<p id="attachment' + id + '"><input type="file" name="file[]"/> <a href=\'javascript:void(0)\'  onclick=\'javascript:$(\"#attachment' + id + '\").remove();\'>{:L('DELETE')}</a></p>');
		$("#add_more").attr('href', 'javascript:add_file(' + (id+1) + ');');
	}
</script>